package net.oschina.arvin.admin;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

/**
 * @author Arvin
 * @time 2017/11/20 21:28
 */
@SpringBootApplication
public class AdminApplication {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(AdminApplication.class);
        app.setWebEnvironment(true);

        //System.setProperty("spring.profiles.active", "dev");

        //System.setProperty("spring.resources.static-locations[0]", "file:///F:/projects/OSChinaGit/xiajiqiu1990/springboot-vue-thymeleaf/springboot-vue-thymeleaf-admin/src/main/resources/custom-static/");

        app.addListeners(new ApplicationListener<ApplicationEnvironmentPreparedEvent>() {
            @Override
            public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {

                System.setProperty("spring.resources.static-locations[0]", "file:///F:/projects/OSChinaGit/xiajiqiu1990/springboot-vue-thymeleaf/springboot-vue-thymeleaf-admin/src/main/resources/custom-static/");

                String staticLocation = event.getEnvironment().getProperty("spring.resources.static-locations[0]");

                System.out.println("staticLocation: " + staticLocation);

            }
        });


        app.run(args);
    }

}
